package lab02.Test32;

<<<<<<< HEAD
import javax.accessibility.AccessibleRelation;
=======

>>>>>>> 50ca08f6b9b89216641cb11ef9adb6e22dd31576
import java.util.HashMap;
import java.util.Map;

public class Test {
    public static void main(String[] args) {
<<<<<<< HEAD
        Map<String,String > person = new HashMap<>();
        person.put("id","1");
        person.put("name","张三");
        person.put("gender","男");
        person.put("age","25");
        person.put("love","java");

        for (Map.Entry<String,String>entry: person.entrySet()){

            System.out.println(entry.getKey()+","+entry.getValue());



        }
        System.out.println("map集合的大小是:"+person.size());

        for(Map.Entry<String,String>entry:  person.entrySet()){

            if (entry.getKey().equals("age")){
                person.remove(entry.getKey());
            }
        }
        System.out.println("map集合的大小是:"+person.size());
    }
=======
        Map<String,String> map=new HashMap();
        //向map中添加数据
        //id—>"1"、name—>"张三"、gender—>"男"、 age—>"25"、love—>"爱学Java"
        map.put("id","1");
        map.put("name","张三");
        map.put("gender","男");
        map.put("age","25");
        map.put("love","爱学Java");

        //遍历一个map
        for (Map.Entry<String,String>entry:map.entrySet()){

            System.out.println(entry.getKey()+":"+entry.getValue());
            // System.out.println(entry.getValue());

        }

        System.out.println("集合的大小："+map.size());

        //删除集合中的键为age的元素
        for (Map.Entry<String,String>entry:map.entrySet()){
            if(entry.getKey().equals("age")){
                map.remove(entry.getKey());
            }
        }
        System.out.println("集合的大小："+map.size());
    }

>>>>>>> 50ca08f6b9b89216641cb11ef9adb6e22dd31576
}
